package com.lx.pc.restful.quotationprice;

import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.lx.pc.domain.vo.quotationprice.QuotationpriceVo;
import com.lx.pc.restful.BaseController;
import com.lx.pc.service.quotationprice.IQuotationpriceService;
import com.lx.pc.utils.OmsPage;

/**
 * 行情一览表价格
 * @author houzhong
 *
 */
@Controller
public class QuotationPriceController extends BaseController{
	
	@Resource(name = "quotationpriceService")
	private IQuotationpriceService quotationpriceService;
	
	@RequestMapping(value = "/toQuotationpriceList.do")
	public ModelAndView toQuotationpriceList() {
		ModelAndView mv = new ModelAndView("/information/pricemore_list");
		return mv;
	}

	/**
	 * 价格一览表
	 * @param v
	 * @param page
	 * @param size
	 * @return
	 * @throws IOException
	 */
	@RequestMapping("/quotationpriceList.do")
	@ResponseBody
    public  String quotationpriceList(QuotationpriceVo v,Integer page,Integer size) throws IOException {
        Map<String,Object> result = new HashMap<String, Object>();
        OmsPage<QuotationpriceVo> pages = quotationpriceService.findByQuotationprice(v, page, size);
        result.put("quotationprice", pages);
        return JSON.toJSONString(result);
    }
	
	/**
	 * 详情页
	 * @return
	 */
	@RequestMapping(value = "/toQuotationpriceDetails.do")
	public ModelAndView toQuotationpriceDetails(String id) {
		ModelAndView mv = new ModelAndView("/information/pricemore_details");
		BigInteger bId = new BigInteger(id); 
		QuotationpriceVo quotationprice = quotationpriceService.findByQuotationpriceId(bId);
		
		mv.addObject("quotationprice",quotationprice);
		return mv;
	}
}
